Skip to content

Go: Handle quoted dots in hostname regexps - #22824

Open
theinfosecguy wants to merge 1 commit into
github:mainfrom
theinfosecguy:go-hostname-regexp-quoting
Open

theinfosecguy wants to merge 1 commit into
github:mainfrom
theinfosecguy:go-hostname-regexp-quoting

Conversation

@theinfosecguy

Copy link
Copy Markdown
Contributor

go/incomplete-hostname-regexp reports literal hostname dots inside Go's \Q...\E quoting as wildcards. For example, ^\Qhttps://github.com/\E$ produces a false positive.

Recognize quoted dots when the complete pattern is statically known. Preserve existing alerts for wildcard dots outside quoting and unsafe concatenations with escaped quote openers, and retain existing behavior for unresolved patterns.

Add regressions for raw and interpreted strings, quoting boundaries, constant aliases, and regexp compilation and matching APIs, plus a change note.

Validation:

  • All four Go CWE-020 query-test suites pass with CodeQL 2.27.0.
  • The new quoting fixture covers 13 unsafe operations and 11 safe operations.
  • QL formatting and git diff --check pass.

Fixes #15894.

@owen-mc

owen-mc commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for this contribution. Before I review this, can I ask how you came across this problem, and why you want it fixed. Did you experience FPs caused by it? Or did you find the issue that you linked to? From my point of view this is quite a lot of added complication in the code for a low value FP fix. There are other things that we could be spending time on that would improve CodeQL more.

@theinfosecguy

Copy link
Copy Markdown
Contributor Author

I came across #15894 while looking for a way to contribute and reproduced it locally. Fair point about the added complexity. I'm happy to pick up something higher priority.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive for go/incomplete-hostname-regexp and \Q

2 participants